<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
</head>
<body>
<a class="menu" id="share_link_btn" onclick="toDo('share_link');" href="javascript:void(0)">分享此网页</div>
<a class="menu" id="capture_area_btn" onclick="toDo('capture_area');" href="javascript:void(0)">网页区域截图</div>
<a class="menu" id="capture_area_btn" onclick="toDo('upload_pic');" href="javascript:void(0)">本地上传图片</div>
<a class="menu" id="option" href="options.html" target="_blank">选项</div>

<script type='text/javascript'>
function toDo(what){
    var bg = chrome.extension.getBackgroundPage();
    switch (what) {
		case 'capture_area':
			bg.screenshot.showSelectionArea();
			window.close();
			break;
		case 'share_link':
			bg.screenshot.shareLink();
			window.close();
			break;
		case 'upload_pic':
			chrome.extension.sendRequest(
				{msg: 'check_cookie'}, 
				function(response){
					var ctrl = response.ctrl;
					if(ctrl){
						window.open('http://0.42qu.com/po/photo','newwindow','height=464,width=600,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')
					}else{
						window.open('http://42qu.com/auth/login?next=http://0.42qu.com/po/photo')
					}
				}
			);

			break;
	}
}
</script>

<style>
.menu {
color: #3d5d6a;
line-height: 26px;
float: left;
white-space: nowrap;
width:100%;
padding-left:21px;
font-size:14px;
margin:0 14px;
display:block;
text-decoration:none;
}
.menu:hover{
color:#d20;
}
#share_link_btn{
background:url(image/collect.png) no-repeat 0 7px;
}
#capture_area_btn{
background:url(image/capture.png) no-repeat 0 7px;
}
#option{
background:url(image/option.png) no-repeat 0 6px;
margin-top:2px;
margin-bottom:6px;
}

</style>
</body>
</html>